package net;

import java.net.Socket;

public class ClientSocket {

	private static final String SERVER_IP = "127.0.0.1";
	private static final int SERVER_PORT = 8181;
	private static boolean isNULL = true;
	private static volatile Socket client = null;

	public static void setNULL(boolean b) {
		isNULL = b;
	}

	public static Socket getClientSocket() throws Exception {
		if (isNULL) {
			synchronized (ClientSocket.class) {
				if (isNULL) {
					client = new Socket(SERVER_IP, SERVER_PORT);
					isNULL = false;
				}
			}
		}
		return client;
	}

}
